#include<iostream>
using namespace std;

class complex
{
private:
	double real, imag;
public:
	complex(int i = 0, int j = 0) :real(i), imag(j) {};
	friend complex operator+(const complex &a, const complex &b);
	friend complex operator-(const complex &a, const complex &b);
	void list();
};

void complex::list()
{
	cout << '(' << real;
	if (imag > 0)cout << '+';
	cout << imag << "i)";
}

complex operator+(const complex& a, const complex& b)
{
	complex c;
	c.real = a.real + b.real;
	c.imag = a.imag + b.imag;
	return c;
}

complex operator-(const complex& a, const complex& b)
{
	complex c;
	c.real = a.real - b.real;
	c.imag = a.imag - b.imag;
	return c;
}



int main()
{
	complex ob1(2, 3), ob2(3, 4);
	complex add = ob1 + ob2;
	complex sub = ob1 - ob2;
	add.list();
	cout << endl;
	sub.list();
	cout << endl;
	return 0;
}